# Copyright 2023 The Dawn & Tint Authors
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
#    list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
#    this list of conditions and the following disclaimer in the documentation
#    and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
#    contributors may be used to endorse or promote products derived from
#    this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

################################################################################
# File generated by 'tools/src/cmd/gen' using the template:
#   tools/src/cmd/gen/build/BUILD.bazel.tmpl
#
# To regenerate run: './tools/run gen'
#
#                       Do not modify this file directly
################################################################################

load("//src/tint:flags.bzl", "COPTS")
load("@bazel_skylib//lib:selects.bzl", "selects")
cc_library(
  name = "ast",
  srcs = [
    "accessor_expression.cc",
    "alias.cc",
    "assignment_statement.cc",
    "attribute.cc",
    "binary_expression.cc",
    "binding_attribute.cc",
    "blend_src_attribute.cc",
    "block_statement.cc",
    "bool_literal_expression.cc",
    "break_if_statement.cc",
    "break_statement.cc",
    "builder.cc",
    "builtin_attribute.cc",
    "call_expression.cc",
    "call_statement.cc",
    "case_selector.cc",
    "case_statement.cc",
    "clone_context.cc",
    "color_attribute.cc",
    "compound_assignment_statement.cc",
    "const.cc",
    "const_assert.cc",
    "continue_statement.cc",
    "diagnostic_attribute.cc",
    "diagnostic_control.cc",
    "diagnostic_directive.cc",
    "diagnostic_rule_name.cc",
    "disable_validation_attribute.cc",
    "discard_statement.cc",
    "enable.cc",
    "expression.cc",
    "extension.cc",
    "float_literal_expression.cc",
    "for_loop_statement.cc",
    "function.cc",
    "group_attribute.cc",
    "id_attribute.cc",
    "identifier.cc",
    "identifier_expression.cc",
    "if_statement.cc",
    "increment_decrement_statement.cc",
    "index_accessor_expression.cc",
    "input_attachment_index_attribute.cc",
    "int_literal_expression.cc",
    "internal_attribute.cc",
    "interpolate_attribute.cc",
    "invariant_attribute.cc",
    "let.cc",
    "literal_expression.cc",
    "location_attribute.cc",
    "loop_statement.cc",
    "member_accessor_expression.cc",
    "module.cc",
    "must_use_attribute.cc",
    "node.cc",
    "override.cc",
    "parameter.cc",
    "phony_expression.cc",
    "pipeline_stage.cc",
    "requires.cc",
    "return_statement.cc",
    "row_major_attribute.cc",
    "stage_attribute.cc",
    "statement.cc",
    "stride_attribute.cc",
    "struct.cc",
    "struct_member.cc",
    "struct_member_align_attribute.cc",
    "struct_member_offset_attribute.cc",
    "struct_member_size_attribute.cc",
    "switch_statement.cc",
    "templated_identifier.cc",
    "type.cc",
    "type_decl.cc",
    "unary_op_expression.cc",
    "var.cc",
    "variable.cc",
    "variable_decl_statement.cc",
    "while_statement.cc",
    "workgroup_attribute.cc",
  ],
  hdrs = [
    "accessor_expression.h",
    "alias.h",
    "assignment_statement.h",
    "attribute.h",
    "binary_expression.h",
    "binding_attribute.h",
    "blend_src_attribute.h",
    "block_statement.h",
    "bool_literal_expression.h",
    "break_if_statement.h",
    "break_statement.h",
    "builder.h",
    "builtin_attribute.h",
    "call_expression.h",
    "call_statement.h",
    "case_selector.h",
    "case_statement.h",
    "clone_context.h",
    "color_attribute.h",
    "compound_assignment_statement.h",
    "const.h",
    "const_assert.h",
    "continue_statement.h",
    "diagnostic_attribute.h",
    "diagnostic_control.h",
    "diagnostic_directive.h",
    "diagnostic_rule_name.h",
    "disable_validation_attribute.h",
    "discard_statement.h",
    "enable.h",
    "expression.h",
    "extension.h",
    "float_literal_expression.h",
    "for_loop_statement.h",
    "function.h",
    "group_attribute.h",
    "id_attribute.h",
    "identifier.h",
    "identifier_expression.h",
    "if_statement.h",
    "increment_decrement_statement.h",
    "index_accessor_expression.h",
    "input_attachment_index_attribute.h",
    "int_literal_expression.h",
    "internal_attribute.h",
    "interpolate_attribute.h",
    "invariant_attribute.h",
    "let.h",
    "literal_expression.h",
    "location_attribute.h",
    "loop_statement.h",
    "member_accessor_expression.h",
    "module.h",
    "must_use_attribute.h",
    "node.h",
    "node_id.h",
    "override.h",
    "parameter.h",
    "phony_expression.h",
    "pipeline_stage.h",
    "requires.h",
    "return_statement.h",
    "row_major_attribute.h",
    "stage_attribute.h",
    "statement.h",
    "stride_attribute.h",
    "struct.h",
    "struct_member.h",
    "struct_member_align_attribute.h",
    "struct_member_offset_attribute.h",
    "struct_member_size_attribute.h",
    "switch_statement.h",
    "templated_identifier.h",
    "traverse_expressions.h",
    "type.h",
    "type_decl.h",
    "unary_op_expression.h",
    "var.h",
    "variable.h",
    "variable_decl_statement.h",
    "while_statement.h",
    "workgroup_attribute.h",
  ],
  deps = [
    "//src/tint/api/common",
    "//src/tint/lang/core",
    "//src/tint/lang/core/type",
    "//src/tint/lang/wgsl",
    "//src/tint/lang/wgsl/features",
    "//src/tint/utils",
    "//src/tint/utils/containers",
    "//src/tint/utils/diagnostic",
    "//src/tint/utils/ice",
    "//src/tint/utils/macros",
    "//src/tint/utils/math",
    "//src/tint/utils/memory",
    "//src/tint/utils/result",
    "//src/tint/utils/rtti",
    "//src/tint/utils/symbol",
    "//src/tint/utils/text",
    "//src/utils",
  ],
  copts = COPTS,
  visibility = ["//visibility:public"],
)
cc_library(
  name = "test",
  alwayslink = True,
  srcs = [
    "alias_test.cc",
    "assignment_statement_test.cc",
    "binary_expression_test.cc",
    "binding_attribute_test.cc",
    "blend_src_attribute_test.cc",
    "block_statement_test.cc",
    "bool_literal_expression_test.cc",
    "break_if_statement_test.cc",
    "break_statement_test.cc",
    "builtin_attribute_test.cc",
    "builtin_texture_helper_test.cc",
    "builtin_texture_helper_test.h",
    "call_expression_test.cc",
    "call_statement_test.cc",
    "case_selector_test.cc",
    "case_statement_test.cc",
    "clone_context_test.cc",
    "color_attribute_test.cc",
    "compound_assignment_statement_test.cc",
    "const_assert_test.cc",
    "continue_statement_test.cc",
    "diagnostic_attribute_test.cc",
    "diagnostic_control_test.cc",
    "diagnostic_directive_test.cc",
    "diagnostic_rule_name_test.cc",
    "discard_statement_test.cc",
    "enable_test.cc",
    "float_literal_expression_test.cc",
    "for_loop_statement_test.cc",
    "function_test.cc",
    "group_attribute_test.cc",
    "helper_test.cc",
    "helper_test.h",
    "id_attribute_test.cc",
    "identifier_expression_test.cc",
    "identifier_test.cc",
    "if_statement_test.cc",
    "increment_decrement_statement_test.cc",
    "index_accessor_expression_test.cc",
    "input_attachment_index_attribute_test.cc",
    "int_literal_expression_test.cc",
    "interpolate_attribute_test.cc",
    "location_attribute_test.cc",
    "loop_statement_test.cc",
    "member_accessor_expression_test.cc",
    "module_test.cc",
    "phony_expression_test.cc",
    "requires_test.cc",
    "return_statement_test.cc",
    "stage_attribute_test.cc",
    "stride_attribute_test.cc",
    "struct_member_align_attribute_test.cc",
    "struct_member_offset_attribute_test.cc",
    "struct_member_size_attribute_test.cc",
    "struct_member_test.cc",
    "struct_test.cc",
    "switch_statement_test.cc",
    "templated_identifier_test.cc",
    "traverse_expressions_test.cc",
    "unary_op_expression_test.cc",
    "variable_decl_statement_test.cc",
    "variable_test.cc",
    "while_statement_test.cc",
    "workgroup_attribute_test.cc",
  ] + select({
    "//conditions:default": [],
  }) + select({
    ":tint_build_wgsl_reader_and_tint_build_wgsl_writer": [
      "module_clone_test.cc",
    ],
    "//conditions:default": [],
  }) + select({
    "//conditions:default": [],
  }),
  deps = [
    "//src/tint/api/common",
    "//src/tint/lang/core",
    "//src/tint/lang/core/constant",
    "//src/tint/lang/core/ir",
    "//src/tint/lang/core/type",
    "//src/tint/lang/wgsl",
    "//src/tint/lang/wgsl/ast",
    "//src/tint/lang/wgsl/common",
    "//src/tint/lang/wgsl/features",
    "//src/tint/lang/wgsl/program",
    "//src/tint/lang/wgsl/resolver",
    "//src/tint/lang/wgsl/sem",
    "//src/tint/lang/wgsl/writer/ir_to_program",
    "//src/tint/utils",
    "//src/tint/utils/containers",
    "//src/tint/utils/diagnostic",
    "//src/tint/utils/ice",
    "//src/tint/utils/macros",
    "//src/tint/utils/math",
    "//src/tint/utils/memory",
    "//src/tint/utils/result",
    "//src/tint/utils/rtti",
    "//src/tint/utils/symbol",
    "//src/tint/utils/text",
    "@gtest",
    "//src/utils",
  ] + select({
    ":tint_build_wgsl_reader": [
      "//src/tint/lang/wgsl/reader",
    ],
    "//conditions:default": [],
  }) + select({
    "//conditions:default": [],
  }) + select({
    ":tint_build_wgsl_writer": [
      "//src/tint/lang/wgsl/writer",
    ],
    "//conditions:default": [],
  }),
  copts = COPTS,
  visibility = ["//visibility:public"],
)

alias(
  name = "tint_build_wgsl_reader",
  actual = "//src/tint:tint_build_wgsl_reader_true",
)

alias(
  name = "tint_build_wgsl_writer",
  actual = "//src/tint:tint_build_wgsl_writer_true",
)

selects.config_setting_group(
    name = "tint_build_wgsl_reader_and_tint_build_wgsl_writer",
    match_all = [
        ":tint_build_wgsl_reader",
        ":tint_build_wgsl_writer",
    ],
)

